4 // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
6 // The use and distribution terms for this software are contained in the file
7 // named license.txt, which can be found in the root of this distribution.
8 // By using this software in any fashion, you are agreeing to be bound by the
9 // terms of this license.
11 // You must not remove this notice, or any other, from this software.
15 // globals.c - global variables/needed across modules
18 // This is the routine in which global variables reside.
21 // This module was created for an interesting reason. NMAKE handles recursive
22 // calls by saving its global variables somewhere in memory. It handles this by
23 // allocating all global variables which have value changes in each recursive
24 // in adjacent memory. The routine called recursively is doMake() and before it
25 // is called the address of this chunk of memory is stored. When the recursive
26 // call returns the memory is restored using the stored address. startOfSave and
27 // endOfSave give the location of this chunk. The reason this method was opted
28 // for is that spawning of NMAKE would consume a lot of memory under DOS. This
29 // might not be very efficient under OS/2 because the code gets shared.
36 #if defined(STATISTICS)
37 unsigned long CntfindMacro
;
38 unsigned long CntmacroChains
;
39 unsigned long CntinsertMacro
;
40 unsigned long CntfindTarget
;
41 unsigned long CnttargetChains
;
42 unsigned long CntStriCmp
;
43 unsigned long CntunQuotes
;
44 unsigned long CntFreeStrList
;
45 unsigned long CntAllocStrList
;
48 BOOL fOptionK
; // TRUE if user specifies /K
49 BOOL fDescRebuildOrder
; // TRUE if user specifies /O
50 BOOL fSlashKStatus
= TRUE
; // no error when slash K specified
53 // Used by action.c & nmake.c
55 // Required to make NMAKE inherit user modified changes to the environment. To
56 // be set to true before defineMacro() is called so that user defined changes
57 // in environment variables are reflected in the environment. If set to false
58 // then these changes are made only in NMAKE tables and the environment remains
63 BOOL fRebuildOnTie
; // TRUE if /b specified, Rebuild on tie
65 // Used by action.c and nmake.c
67 // delList is the list of delete commands for deleting inline files which are
68 // not required anymore (have a NOKEEP action specified.
72 // Complete list of generated inline files. Required to avoid duplicate names
75 STRINGLIST
* inlineFileList
;
78 // No of blanks is same as no of Allowed options in NMAKE; currently 14
79 // L = nologo, H = help
80 // corr to ABCDEHIKLNPQRSTUY?
81 char makeflags
[] = "MAKEFLAGS= ";
82 BOOL firstToken
; // to initialize parser
84 UCHAR flags
; // holds -d -s -n -i -u
85 UCHAR gFlags
; // "global" -- all targets
87 STRINGLIST
* makeTargets
; // list of targets to make
88 STRINGLIST
* makeFiles
; // user can specify > 1
94 BOOL colZero
= TRUE
; // global flag set if at column zero of a makefile/tools.ini
98 INCLUDEINFO incStack
[MAXINCLUDE
]; //Assume this is initialized to null
101 // Inline file list -- Gets created in lexer.c and is used by action.c to
102 // produce a delete command when 'NOKEEP' or Z option is set
104 SCRIPTLIST
* scriptFileList
;
107 BOOL init
; // global boolean value to indicate if tools.ini is being parsed
108 UCHAR stack
[STACKSIZE
];
109 int top
= -1; // gets pre-incremented before use
110 unsigned currentLine
; // used for all error messages
115 MACRODEF
* macroTable
[MAXMACRO
];
116 MAKEOBJECT
* targetTable
[MAXTARGET
];
118 STRINGLIST
* dotSuffixList
;
119 STRINGLIST
* dotPreciousList
;
131 unsigned numCommands
;
133 char CmdLine
[MAXCMDLINELENGTH
];
137 UCHAR ifStack
[IFSTACKSIZE
];
138 int ifTop
= -1; // pre-incremented
139 char * lbufPtr
; // ptr to alloced buf
140 char * prevDirPtr
; // ptr to directive
141 unsigned lbufSize
; // initial size
147 char * dollarDollarAt
;
148 char * dollarLessThan
;
151 STRINGLIST
* dollarQuestion
;
152 STRINGLIST
* dollarStarStar
;
160 const char suffixes
[] = ".SUFFIXES";
161 const char ignore
[] = ".IGNORE";
162 const char silent
[] = ".SILENT";
163 const char precious
[] = ".PRECIOUS";